$(document).ready(function() {
	$('#registerSubmitC').click(function(){
		/*get the values from the form*/
		var email = $('#register_email').val();
    var email2 = $('#register_email2').val();
		var username = $('#register_username').val();
		var password = $('#register_password').val();
    var password2 = $('#register_password2').val();
    var name = $('#register_name').val();
    var surname = $('#register_surname').val();
    /*check for validity*/
		if( email != "" && email == email2 && username != "" && password !="" & password == password2){
       /*send data to logic*/
       $.post("logic.php", {call: "register", email: email, username: username, password: password, firstname: name, lastname: surname}, function(xml){
				if(xml.length >0) {
             if(parse_status($xml))
               window.load("index.php") ;
             else
                alert("error") ;
            }
				});
		}
		else{
			alert("bad submit");
		}
	});
 });
 
